/* CJLib -- choices.h */


#ifndef CJL_H_CHOICES

#define CJL_H_CHOICES

/***************************************************/
/* Structures etc for new version of choices/prefs */
/***************************************************/

/* Structures for the details of the variables to be loaded/saved */

enum tag_types
{
  TAGNONE,
  TAGINT,
  TAGSTR,
  TAGDOUBLE,
  TAGBOOL,
  TAGXINT,
  TAGINT_A,
  TAGXINT_A
};

typedef struct
{
  char *token;
  enum tag_types type;
  void *address;
  int  array_size;
} CJL_choices_tag;


/* structures for the load/save actions */

typedef struct
{
  char *write_err;
} choices_savedata;


typedef struct
{
//////  char *not_found;
  char *no_read;
  char *malloc_fail;
} choices_loaddata;


#define USE_FLEX   TRUE
#define USE_MALLOC FALSE

typedef struct
{
  osbool save;
  osbool use_flex;       // type of memory claim
  char *leafname;
  char *app_name;
  char *author_dir;
  char *file_id;
  union
  {
    choices_loaddata load;
    choices_savedata save;
  } data;
} CJL_choices_loadsavedata;


/* The exported functions for any user to call */

extern osbool CJL_ChoicesMakeFilename (CJL_choices_loadsavedata *d, char *full_filename);
extern void CJL_ChoicesSave (CJL_choices_loadsavedata *d, CJL_choices_tag *table);
extern void CJL_ChoicesLoad (CJL_choices_loadsavedata *d, CJL_choices_tag *table);


#endif

